﻿package org.nickro.externallibrary.display
{
    import flash.display.*;
    import flash.errors.*;
    import flash.geom.*;

    public class DisplayUtils extends Object
    {

        public function DisplayUtils()
        {
            throw new IllegalOperationError(this + " should not be instantiated");
        }// end function

        public static function removeAllChildren(param1:DisplayObjectContainer) : void
        {
            while (param1.numChildren > 0)
            {
                
                param1.removeChildAt(0);
            }
            return;
        }// end function

        public static function drawRect(param1:Graphics, param2:int, param3:int, param4:Number, param5:Number, param6:Number, param7:Number = 1, param8:Number = 0, param9:uint = 0, param10:Number = 0) : void
        {
            param1.lineStyle(param8, param9, param10);
            param1.beginFill(param6, param7);
            param1.drawRect(param2, param3, param4, param5);
            param1.endFill();
            return;
        }// end function

        public static function drawDummyRect(param1:Graphics, param2:Number = 16777215, param3:Number = 1) : void
        {
            param1.beginFill(param2, param3);
            param1.drawRect(0, 0, 100, 100);
            param1.endFill();
            return;
        }// end function

        public static function drawCircle(param1:Graphics, param2:int, param3:int, param4:Number, param5:Number, param6:Number = 1, param7:Number = 0, param8:uint = 0, param9:Number = 0) : void
        {
            param1.lineStyle(param7, param8, param9);
            param1.beginFill(param5, param6);
            param1.drawCircle(param2, param3, param4);
            param1.endFill();
            return;
        }// end function

        public static function drawTriangle(param1:Graphics, param2:Rectangle, param3:Number, param4:Number = 1) : void
        {
            param1.beginFill(param3, param4);
            param1.moveTo(param2.x, param2.y);
            param1.lineTo(param2.x + param2.width, param2.y + 0.5 * param2.height);
            param1.lineTo(param2.x, param2.y + param2.height);
            param1.endFill();
            return;
        }// end function

        public static function setColor(param1:DisplayObject, param2:Number) : void
        {
            if (param1 == null)
            {
                return;
            }
            var _loc_3:* = new ColorTransform();
            _loc_3.color = param2;
            var _loc_4:* = new Transform(param1);
            new Transform(param1).colorTransform = _loc_3;
            return;
        }// end function

        public static function centerOnStage(param1:DisplayObject, param2:Number = 0, param3:Number = 0, param4:Boolean = false) : void
        {
            var _loc_5:* = param1.stage.stageWidth / 2;
            var _loc_6:* = param1.stage.stageHeight / 2;
            _loc_5 = _loc_5 + param2;
            _loc_6 = _loc_6 + param3;
            if (param4)
            {
                _loc_5 = _loc_5 - param1.width / 2;
                _loc_6 = _loc_6 - param1.height / 2;
            }
            param1.x = _loc_5;
            param1.y = _loc_6;
            return;
        }// end function

    }
}
